SPB Git forge

spb/polyllm

Public
15commits 1branches 0releases
2.2 MBsize
maindefault branch
13 days agolast push
TypeScript 97.4% SQL 1% JavaScript 0.9% CSS 0.6%
974 B · 19 lines typescript
Raw Blame History
1import { withUser, json } from "@/lib/api";2import { getArenaShare, revokeArenaShare, shareArenaSession } from "@/lib/arena/service";3import { LIMITS } from "@/lib/rate-limit";45export const dynamic = "force-dynamic";6type P = { id: string };78/** GET /api/arena/:id/share → { share: { id, createdAt, viewCount } | null } */9export const GET = withUser<P>(async ({ user }, { id }) => json({ share: await getArenaShare(user.id, id) }));1011/** POST /api/arena/:id/share → { share } — creates (or refreshes) the public snapshot at /share/arena/:shareId. */12export const POST = withUser<P>(async ({ user }, { id }) => json({ share: await shareArenaSession(user.id, id) }, { status: 201 }), { limit: { ...LIMITS.share, key: "arena-share" } });1314/** DELETE /api/arena/:id/share → { ok } — revokes every active link for the session. */15export const DELETE = withUser<P>(async ({ user }, { id }) => {16  await revokeArenaShare(user.id, id);17  return json({ ok: true });18});19